<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .dv{width: 500px;margin: 0 auto;display: flex;flex-direction: column;}
    input{width:200px;}
    input[type="button"]{width:100px;}
</style>
<script type="text/javascript">
    window.onload = function () {
        var masg = document.getElementsByName('mission')
        var btn = document.getElementById('btn')
        function transFun(x){
            alert(x)
        }
        btn.onclick = function(){
            console.log(masg[0].value)
            console.log(masg[1].value)
            for (var i=0;i<masg.length;i++) {
                transFun(masg[i].value)
            }
        }

    }
</script>
<body>
<div class="dv">
    <input type="text" name="mission" value="北京市">
    <input type="text" name="mission" value="昌平区">
    <input type="button" id="btn" value="提交">
</div>

</body>
</html>